import { createRouterGuards } from "./utils";
import { baseRoutes, menuRoutes } from "./routes";

const router = createRouter({
  history: createWebHistory(BASE_PATH),
  routes: [
    {
      path: "/",
      redirect: "/home",
      children: [...baseRoutes, ...menuRoutes],
    },
  ],
});

const setupRouter = (app: App) => {
  app.use(router);
  createRouterGuards(router);
  return router;
};

export { router, menuRoutes, setupRouter };
